<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2025/7/31
 * Time: 9:57
 */

namespace app\service;


class Email
{
    public function send($email,$title = '',$body = ''){
        $message = new \Swift_Message($title);
        $message = $message->setFrom('ppf1788@sina.com');
        $message = $message->setTo($email);
        $message = $message->setBody($body,'text/html' );
        $transport = new \Swift_SmtpTransport('smtp.sina.com', 465,'ssl');
        $transport = $transport->setUsername('ppf1788@sina.com');
        $transport = $transport->setPassword('14c1f2883d0b344e');
        $mailer = new \Swift_Mailer($transport);
        $mailer->send($message);
        //return json(['code' => 200,'msg' => '成功','data' => $res],200);
    }
}